import { http } from './request.js';

// 评价相关API
export const reviewApi = {
    // 获取商品评价
    getProductReviews(productId, params) {
        return http.get(`/user/reviews/product/${productId}`, params);
    },

    // 添加评价
    addReview(data) {
        return http.post('/user/reviews', data);
    },

    // 获取我的评价
    getMyReviews(params) {
        return http.get('/user/reviews/my', params);
    },

    // 删除评价
    deleteReview(id) {
        return http.delete(`/user/reviews/${id}`);
    },

    // 更新评价
    updateReview(id, data) {
        return http.put(`/user/reviews/${id}`, data);
    },

    // 获取评价详情
    getReviewById(id) {
        return http.get(`/user/reviews/${id}`);
    },

    // 分页获取商品评价
    getProductReviewPage(productId, params) {
        return http.get(`/user/reviews/product/${productId}/page`, params);
    },

    // 获取评价统计
    getReviewStats(productId) {
        return http.get(`/user/reviews/stats/${productId}`);
    }
}; 